import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
import { fileURLToPath, URL } from 'node:url'

export default defineConfig(async () => ({
  plugins: [
    vue(),
    // viteCommonjs() // 如果依赖都已转为ESM可移除
  ],
  build: {
    
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      'vue': 'vue/dist/vue.esm-bundler.js' // 添加这一行
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        implementation: (await import('sass-embedded')).default,
        sourceMap: false,
        additionalData: `
          @use "@/styles/theme/index.scss" as *;
          @use "@/styles/element-ui.scss" as *;
        `
      }
    }
  }
})) 